/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#ifndef __BUILDER_UTILITY_H__
#define __BUILDER_UTILITY_H__

#include "InputCode.h"
#include "OgreColourValue.h"
#include <QtGui/QColor>

namespace PQBuilder
{ 
	KeyCode translateQtKey(unsigned int key);
	class ColorConverter
    {
    public:
		inline static QColor toQt(const Ogre::ColourValue &value)
		{
			int r=(int)(value.r*255);
			int g=(int)(value.g*255);
			int b=(int)(value.b*255);
			int a=(int)(value.a*255);

			return QColor(r,g,b,a);
		}

		inline static Ogre::ColourValue toOgre(const QColor &value)
		{
			float r=((float)value.red())/255.0f;
			float g=((float)value.green())/255.0f;
			float b=((float)value.blue())/255.0f;
			float a=((float)value.alpha())/255.0f;

			return Ogre::ColourValue(r,g,b,a);
		}
    };

	

}
#endif
